using System.ServiceModel;
using System.ServiceModel.Channels;
namespace jSLApp.Client.MainService {
public class MainServiceSyncedChannel
{
private MainServiceChannel _asyncChannel;
#region Constructors
        public MainServiceSyncedChannel(string endpointConfigurationName, EndpointAddress remoteAddress)
        {
            var factory = new ChannelFactory<MainServiceChannel>(endpointConfigurationName, remoteAddress);
            CreateChannel(factory);
        }

        public MainServiceSyncedChannel(Binding binding, EndpointAddress rem)
        {
            var factory = new ChannelFactory<MainServiceChannel>(binding, rem);
            CreateChannel(factory);
        }

        public MainServiceSyncedChannel(string endpointConfigurationName)
        {
            var factory = new ChannelFactory<MainServiceChannel>(endpointConfigurationName);
            CreateChannel(factory);
        }

        private void CreateChannel(ChannelFactory<MainServiceChannel> factory)
        {
            _asyncChannel = factory.CreateChannel();
        }

        #endregion


public string SayHello()
{
var result = _asyncChannel.BeginSayHello(null,null);
return _asyncChannel.EndSayHello(result);
}

}
}
